<template>
	<!--供应商报价单-->
	<view class="page-content">
		<view class="page-top">
			<!--导航-->
			<view class="nav">
				<view class="nav-item" @click="handleActive(1)"
					:class="[active === 1 ? 'active' : active === 2 ? '' : '']">
					POP
				</view>
				<view class="nav-item" @click="handleActive(2)"
					:class="[active === 1 ? '' : active === 2 ? 'active' : '']">
					道具
				</view>
			</view>
		</view>
		<!--列表-->
		<scroll-view class="page-body" :scroll-top="scrollTop" scroll-y="true" @scrolltolower="loadmore()">
			<template v-if="active===1">
				<template v-if="datalist && datalist.length > 0 ">
					<block v-for="(item,index) in datalist" :key="index">
						<view class="box-li" @click="todetail('pop',item.id)"
							:style="{'border-bottom':pageType==='popcz'?'16rpx solid #f5f5f5':'1rpx solid #f5f5f5'}">
							<view class="box-li-l">
								<view class="name">{{item.name}}
									<text class="tag"
										:style="{background:item.statu===1?'#198FFF':item.statu===2?'#fff':item.statu===3?'#EEEEEE':'',color:item.statu===1?'#fff':item.statu===2?'#FE5252':item.statu===3?'#999':'',border:item.statu===1?'1rpx solid #198FFF':item.statu===2?'1rpx solid #FE5252':item.statu===3?'1rpx solid #eee':''}">{{item.statu===1?'已上传':item.statu===2?'待补齐':item.statu===3?'未上传':''}}</text>
								</view>
							</view>
							<view class="box-li-r icons icon-gengduo"></view>
						</view>
					</block>
					<!-- 上拉加载 -->
					<view class="det-con-more">
						<load-more :loadmore="load_more1"></load-more>
					</view>
				</template>
				<!--无数据-->
				<empty v-else no-full type="noData"></empty>
			</template>
			<template v-if="active===2">
				<template v-if="datalist && datalist.length > 0 ">
					<block v-for="(item,index) in datalist" :key="index">
						<view class="box-li" @click="todetail('prop',item.id)"
							:style="{'border-bottom':pageType==='popcz'?'16rpx solid #f5f5f5':'1rpx solid #f5f5f5'}">
							<view class="box-li-l">
								<view class="name">{{item.name}}
									<text class="tag"
										:style="{background:item.statu===1?'#198FFF':item.statu===2?'#fff':item.statu===3?'#EEEEEE':'',color:item.statu===1?'#fff':item.statu===2?'#FE5252':item.statu===3?'#999':'',border:item.statu===1?'1rpx solid #198FFF':item.statu===2?'1rpx solid #FE5252':item.statu===3?'1rpx solid #eee':''}">{{item.statu===1?'已上传':item.statu===2?'待补齐':item.statu===3?'未上传':''}}</text>
								</view>
							</view>
							<view class="box-li-r icons icon-gengduo"></view>
						</view>
					</block>
					<!-- 上拉加载 -->
					<view class="det-con-more">
						<load-more :loadmore="load_more2"></load-more>
					</view>
				</template>
				<!--无数据-->
				<empty v-else no-full type="noData"></empty>
			</template>
		</scroll-view>
		<!--编辑框-->
		<w-popup :show="showtip" :type="type1" @change="change1">
			<view class="w-tip">
				<view class="w-tit" v-if="tipType===1 || tipType===2">{{tipType===1?'编辑':tipType===2?'新增':''}}</view>
				<view class="w-con">
					<view class="input-row" v-if="tipType===1 || tipType===2">
						<input class="input-row-w" type="text" v-model="inputVal" placeholder="请输入编辑内容"
							confirm-type="search" placeholder-style="color:#999"></input>
						<image class="icon-tb3" v-if="inputVal!=''" @click.stop="clear"
							:src="$mAssetsPath.icon_qingchu"></image>
					</view>
					<view class="txt-row" v-if="tipType===3">是否确认删除？</view>
				</view>
				<view class="w-but">
					<view class="w-but-txt" @click="cancel('tip')">取消</view>
					<view class="w-but-txt" @click="confirm">确认</view>
				</view>
			</view>
		</w-popup>
	</view>
</template>

<script>
	import wPopup from '@/components/w-popup/w-popup2.vue'; // 弹窗
	import {
		mapGetters,
		mapActions
	} from 'vuex'
	import {
		sendSmss,
		logins,
		registers,
	} from '@/common/api.js';
	import store from '@/store'
	import wTit from '@/components/w-tit/w-tit-back.vue';
	import loadMore from '@/components/uni-load-more/load-more.vue';
	export default {
		components: {
			wTit,
			loadMore
		},
		data() {
			return {
				showtip: false, //是否显示弹窗2
				content1: '顶部弹 popup',
				type1: '', //弹窗显示方式
				scrollTop: 0,
				noData: false,
				
				load_more1: '', //下拉加载文字
				load_more2: '', //下拉加载文字
				
				load_sta: false, //是否是加载状态
				datalist: [{
					name: '供应商一',
					statu: 1, //1-已上传  2-待补齐 3-未上传
					id: 1,
				}, {
					name: '供应商二',
					statu: 1, //1-已上传  2-待补齐 3-未上传
					id: 2,
				}, {
					name: '供应商三',
					statu: 2, //1-已上传  2-待补齐 3-未上传
					id: 3,
				}, {
					name: '供应商四',
					statu: 3, //1-已上传  2-待补齐 3-未上传
					id: 4,
				}, {
					name: '供应商五',
					statu: 3, //1-已上传  2-待补齐 3-未上传
					id: 5,
				}, {
					name: '供应商六',
					statu: 3, //1-已上传  2-待补齐 3-未上传
					id: 6,
				}],
				formData: {
					page: 1,
					limt: 10
				},
				pageType: '', //页面类型 popcz-POP材质
				tipType: 0, // 1-编辑 2-新增 3-删除
				inputVal: '',
				active: 1,
			}
		},
		computed: {

		},
		onLoad(option) {
			console.log(222, option)
			if (option.pageType) {
				this.pageType = option.pageType
			}
		},
		onNavigationBarButtonTap(e) {
			console.log(23, e)
			if (e.index == 0) {
				let type = 'd';
				uni.navigateTo({
					url:`/pages/contact/editTeams?type=${type}`
				})
			}
		},
		methods: {
			...mapActions('user', ['setToken']),
			todetail(type,id){
				uni.navigateTo({
					url:`/pages/user/quotationDetail?pageType=${type}&id=${id}`
				})
			},
			//导航
			handleActive(e) {
				this.active = e;
			},
			//下拉加载
			loadmore() {
				console.log('下拉加载');
				let _self = this;
				_self.load_sta = true;
				_self.formData.page++;
				_self.getdata(_self.formData);
			},
			//跳转编辑
			toEdit(type, id, name) {
				if (this.pageType === 'popcz') {
					this.tipType = 1;
					this.showtip = true;
					this.content1 = 'center';
					this.type1 = 'center';
					this.inputVal = name;
				} else {
					uni.navigateTo({
						url: `/pages/user/powers?type=${type}&name=${name}&id=${id}`
					})
				}
			},
			//删除
			toDelete() {
				this.showtip = true;
				this.content1 = 'center';
				this.type1 = 'center';
			},
			//取消
			cancel() {
				this.show = false
				this.showtip = false
			},
			change1(e) {
				if (!e.show) {
					this.showtip = false
				}
			},
			//清空
			clear() {
				this.inputVal = '';
			}
		}
	}
</script>

<style lang="scss">
	/* 提示窗口 */
	.w-tip {
		/* #ifndef APP-NVUE */
		display: flex;
		flex-direction: column;
		/* #endif */
		width: 70vw;
		border-radius: 10rpx;
		background-color: #fff;
		box-shadow: 0rpx 7rpx 7rpx 0rpx rgba(0, 0, 0, 0.1);
		margin: 30rpx auto 0;

		.w-tit {
			font-size: 36rpx;
			font-weight: bold;
			color: $font-color-3;
			line-height: 60rpx;
			height: 60rpx;
			margin-top: 20rpx;
			text-align: center;
		}

		.w-but {
			display: flex;
			font-size: 32rpx;
			font-weight: 400;
			color: $font-color-b3;
			height: 84rpx;
			line-height: 84rpx;

			.w-but-txt {
				flex: 1;
				text-align: center;
				border-right: 1rpx solid #f5f5f5;
			}

			.w-but-txt:last-of-type {
				border-right: none;
			}
		}

		.w-con {
			display: flex;
			text-align: center;
			font-weight: 400;
			padding: 60rpx 30rpx;
			border-bottom: 1rpx solid #f5f5f5;

			.txt-row {
				width: 100%;
				text-align: center;
				font-size: 32rpx;
				color: $font-color-3;
			}

			.input-row {
				display: flex;
				align-items: center;
				justify-content: space-between;
				width: 100%;
				height: 66rpx;
				background: #fff;
				border-radius: 10rpx;
				background: $uni-bg-color-grey;

				.icon-tb3 {
					width: 34rpx;
					height: 34rpx;
					margin: 0 20rpx;
				}

				.input-row-w {
					padding-left: 30rpx;
					text-align: left;
					font-size: 28rpx;
					font-weight: 400;
					line-height: 20px;
					color: $font-color-9;
					width: calc(100% - 74rpx);
				}
			}
		}
	}

	.titleNview-placing {
		height: var(--status-bar-height);
		box-sizing: content-box;
		background: $uni-bg-color;
		display: block;
		position: sticky;
		top: 0rpx;
		z-index: 9999;
		overflow: hidden
	}

	.det-con-more {
		display: flex;
		justify-content: center;
		align-items: center;
		margin-bottom: 10rpx;
		color: #bbb;
		font-size: 24rpx;
	}

	.icon-tb {
		width: 36rpx;
		height: 36rpx;
		margin-left: 50rpx;
	}

	.page-content {
		display: flex;
		flex-direction: column;
		background: $uni-bg-color;
		width: 100vw;
		height: 100%;
		border-top: 1rpx solid #f5f5f5;

		.page-top {
			display: flex;
			flex-direction: column;
			background: $uni-bg-color-grey;

			.nav {
				height: 88rpx;
				padding: 0 30rpx;
				display: flex;
				align-items: center;
				text-align: center;
				font-size: 36rpx;
				color: $font-color-3;
				font-weight: bold;

				.nav-item {
					flex: 1;
					position: relative;

					&::after {
						content: '';
						width: 0;
						height: 8rpx;
						background-color: $uni-but-bg-color;
						position: absolute;
						left: 50%;
						bottom: -20rpx;
						transform: translateX(-50%);
						transition: .3s;
					}

					&.active {
						font-size: 36rpx;
						font-weight: bold;
						color: $font-color-b3;

						&::after {
							width: 32rpx;
						}
					}
				}
			}
		}

		.page-body {
			height: 100%;
			display: flex;
			flex-direction: column;

			.tip {
				font-size: 28rpx;
				font-weight: 400;
				line-height: 17px;
				color: $font-color-3;
				height: 80rpx;
				line-height: 80rpx;
				padding: 0 30rpx;
				background: $uni-bg-color-grey;
			}

			.box-li {
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 30rpx;

				.box-li-r {
					display: flex;
					align-items: center;
					color: $font-color-9;
				}

				.box-li-l {
					display: flex;

					.name {
						display: flex;
						align-items: center;
						font-size: 32rpx;
						font-weight: 400;
						color: $uni-text-color;

						.tag {
							margin-left: 20rpx;
							height: 40rpx;
							line-height: 40rpx;
							padding: 0 10rpx;
							font-size: 20rpx;
							border-radius: 4rpx;
						}
					}
				}
			}
		}
	}
</style>
